<!doctype html>
<html lang="{{ app()->getLocale() }}">
<head>
<script>
  function onSubmit(op,corpId){
	  	  document.getElementById('optioninfo').value=op;
	   	  document.getElementById('corp_id').value=corpId;
          var form = document.getElementById('userForm');
          form.action="corplist/"+op;
          form.submit();
      }
  function onSubmitDelete(op,corpId){
      	  document.getElementById('optioninfo').value=op;
       	  document.getElementById('corp_id').value=corpId;
          if (false === confirm('削除しますか？') )return;
          var form = document.getElementById('userForm');
          form.action="corplist/"+op;
          form.submit();
     }
  function onSubmitCsv(op,corpId){
    	   document.getElementById('optioninfo').value=op;
       	   document.getElementById('corp_id').value=corpId;

           var form = document.getElementById('userForm');
           form.action="corplist/"+op;
           form.submit();
      }
  </script>

</head>

@extends('layouts.admin_common') @section('content')

<div class="breadcrumbs_container">
	{{Breadcrumbs::render('admin.corp_list') }}</div>
<div class="system_tab_line"></div>

<body>
	<div id="outDiv">

		<table class="table table-condensed">
			<tr>
				<td>会社名</td>
				<td>会社名カナ</td>
				<td>郵便番号</td>
				<td>会社TEL</td>
				<td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
			</tr>
			<tr>@foreach ($corpInfos as $corpInfo)


			<tr>
				<td>{{$corpInfo->corp_name}}</td>
				<td>{{$corpInfo->corp_catelogue}}</td>
				<td>{{$corpInfo->corp_postcode}}</td>
				<td>{{$corpInfo->corp_tel}}</td>
				<td><input type="button" value="修正"
					class="btn btn-primary button_normal"
					onclick="onSubmit('create','{{$corpInfo->corp_id}}')" /><input
					type="button" value="削除" class="btn btn-primary button_normal"
					onclick="onSubmitDelete('delete','{{$corpInfo->corp_id}}')" /></td>
			</tr>
			@endforeach
		</table>
		<form class="form-inline" id="userForm" method="post"
			enctype="multipart/form-data">
			<table border="0" cellspacing="0" style="width: 1300px;">
				<tr>
					<td align="right" style="width: 1300px;"><input type="button"
						value="新規" class="pure-button pure-button-primary button_normal"
						onclick="onSubmit('create','')" /></td>
					<td><label for="sample1" class="btn btn-primary button_normal">Csv取込
							<input type="file" name="csv_file" id="sample1"
							style="display: none;" class="btn btn-primary button_normal"
							onChange="onSubmitCsv('csv','{{$corpInfo->corp_id}}')" />
					</label></td>

			</table>
			<div>@if(isset($success)) {{$success}} @endif</div>
			<div>@if(isset($error)) {{$error}} @endif</div>
			<input type="hidden" id="corp_id" name="corp_id"> <input
				type="hidden" id="optioninfo" name="optioninfo"> <input
				type="hidden" name="_token" value="{{csrf_token()}}">
		</form>
	</div>
</body>
</html>
@endsection
